package org.sol.tools.commands;

import java.util.ArrayList;
import java.util.List;

public class Application {
	
	private String name;
	private String version;
	private String copyright;
	
	private List<Command> commands = new ArrayList<Command>();
	
	public Application(String name, String version, String copyright) {
		this.name = name;
		this.version = version;
		this.copyright = copyright;
	}

	protected String getName() {
		return name;
	}

	protected void setName(String name) {
		this.name = name;
	}

	protected String getVersion() {
		return version;
	}

	protected void setVersion(String version) {
		this.version = version;
	}

	protected String getCopyright() {
		return copyright;
	}

	protected void setCopyright(String copyright) {
		this.copyright = copyright;
	}

	protected List<Command> getCommands() {
		return commands;
	}

	protected void setCommands(List<Command> commands) {
		this.commands = commands;
	}
	
	public boolean parse(String[] args) {
		return false;
	}

	public String help() {
		StringBuilder string = new StringBuilder();
		
		string.append(String.format("Application: %s. Version: %s\n", name, version));
		string.append(String.format("%s\n\n", copyright));
		
		for (Command command : commands) {
			string.append(command.help());
		}
		
		return string.toString();
	}
}
